package com.duofan.gmall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.duofan.gmall.common.exception.NoStockException;
import com.duofan.gmall.common.to.mq.SeckillOrderTo;
import com.duofan.gmall.common.utils.PageUtils;
import com.duofan.gmall.order.entity.OrderEntity;
import com.duofan.gmall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author Vincent
 * @email wu_peizhen@126.com
 * @date 2023-05-08 06:52:31
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    OrderSubmitRespVo submitOrder(OrderSubmitVo orderSubmitVo) throws NoStockException;

    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity);

    /**
     * 获取当前订单支付信息
     * @return
     */
    PayVo getOrderPay(String orderSn);

    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝支付结果
     * @param vo
     * @return
     */
    String handlePayResult(PayAsyncVo vo);

    /**
     * 创建秒杀订单
     * @param orderTo
     */
    void createSeckillOrder(SeckillOrderTo orderTo);

}

